package com.zhtools.excel.tester;

import java.math.BigDecimal;
import java.util.Date;

public class OrderFactory {
    public static Order createOrder() {
        int score = (int) (1 + Math.random() * 10);
        long pId = (long) (100 + Math.random() * 1000000);
        double price = 1 + Math.random() * 100;

        Order order = new Order();
        order.setCreateTime(new Date());
        order.setScore(score);
        order.setOrderId(pId);
        order.setPrice(new BigDecimal(price).setScale(2, BigDecimal.ROUND_HALF_UP));
        order.setOrderItem(OrderItemFactory.createOrderItem());
        return order;
    }
}
